package com.dfs.util;

import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * 颜色工具类
 * </p>
 *
 * @author : dfs
 * @date : 2021/9/10
 */
@Configuration
public class ColorUtil {
    // 根据销量赋颜色
    public static Map<String, String> colorBySaleMap(Integer sale) {
        Map<String, String> map = new HashMap<>();
        String color = "";
        if (sale <= 50) {
            color = "#96dee8";
        }
        if (sale > 50 && sale <= 150) {
            color = "#c4ebad";
        }
        if (sale > 150 && sale <= 250) {
            color = "#6be6c1";
        }
        if (sale > 250 && sale <= 350) {
            color = "#3fb1e3";
        }
        if (sale > 350) {
            color = "#a0a7e6";
        }
        map.put("color", color);
        return map;
    }
}
